package com.enzo.prms.common.exception.base;

import java.lang.reflect.Method;

import com.enzo.prms.common.exception.annotation.Exceptional;
import com.enzo.prms.common.exception.base.handler.ServiceHandler;

@Exceptional(errorCode="SERVICE001",handlers={ServiceHandler.class})
public class ServiceException extends BaseAppRuntimeException {

	private static final long serialVersionUID = 4230802008213252999L;

	public ServiceException() {
		super();
	}

	public ServiceException(String errorCode, String message, Throwable cause) {
		super(errorCode, message, cause);
	}

	public ServiceException(String message, Throwable cause) {
		super(message, cause);
	}

	public ServiceException(String message) {
		super(message);
	}

	public ServiceException(Throwable cause) {
		super(cause);
	}
	
	public static void main(String[] args)throws Exception {
		Class c=Class.forName(ServiceException.class.getName());
		Method[] methods=c.getDeclaredMethods();
		boolean f=c.isAnnotationPresent(Exceptional.class);
		if(f){
			Exceptional e=(Exceptional)c.getAnnotation(Exceptional.class);
			System.out.println(e.errorCode());
			System.out.println(e.handlers()[0].getName());
		}
	}
	
	

}
